<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {:widget_st('layui','css')}
  {:widget_st('admin','css')}
  {:widget_st('jq','js')}
  {:widget_st('laydate','js')}    
  {:widget_st('layui','js')}  
  {:widget_st('common','js')} 
</head>
{:do_action('admin_head')}
<style>
  .line-through {
    text-decoration: line-through;
    color: red;
  }
  .layui-col-sm2{
    text-align: center;
  }
</style>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <?php $form_widget = new \app\common\widget\FormPro();  ?>
      <?php if(!in_array($tb_name,['zf_category_model'])){ ?>
        <a href="?t=1" class="layui-btn">自定义参数</a>
      <?php } ?>
      <a href="?t=4" class="layui-btn">设置需引用的静态文件</a>
      <a href="?t=2" class="layui-btn">导入参数</a>
      <a href="?t=3" class="layui-btn">当前参数</a>
      <?php if($t==1){ ?>
        <style>
          .layui-select{
            height: 23px;
          }
        </style>
        <form method="post" class="info_tj" >
          <div class="layui-col-sm12">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-sm12">
                  <div class="layui-card" style="padding-left: 10px;">
                    <div class="layui-card-header">自定义参数</div>
                    {$form_widget->form_radio(['title'=>'是否双栏','name'=>'zf_two_column','data'=>$zf_two_column,'parm_data'=>['0'=>'单栏','1'=>'双栏'],'theme'=>2])|raw}
                    {$form_widget->form_radio(['title'=>'是否开启','name'=>'zf_form_status','data'=>$zf_form_status,'parm_data'=>['0'=>'关闭','1'=>'开启'],'theme'=>2])|raw}
                    
                    
                    <br/>
                    <h1>左边栏目</h1>
                    <?php foreach($list['left'] as $k=>$vo){ ?>
                      <div class="layui-row">
                        <div class="layui-col-sm2">
                          <div>
                            <input name="name[]" type="hidden" value="{$vo['name']}" />
                            <span class="{$vo['checked']==0?'line-through':''}" style="font-size: 16px;" >{$vo['name']}<br>({$vo['type']})</span>
                          </div>
                          <div class="" >
                            <input class="layui-input" name="sort[]" value="{$vo['sort']|default=''}" placeholder="排序" />
                          </div>
                        </div>
                        <div class="layui-col-sm2">
                          <select class="layui-input layui-select" name="model[]">
                            <?php foreach(formProActionArrCate() as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['model']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="checked[]">
                            <?php foreach([['id'=>'1','name'=>'显示'],['id'=>'0','name'=>'隐藏']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['checked']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="postion[]">
                            <?php foreach([['id'=>'left','name'=>'左边'],['id'=>'right','name'=>'右边']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['postion']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="theme[]">
                            <?php foreach([['id'=>'1','name'=>'模板1'],['id'=>'2','name'=>'模板2'],['id'=>'3','name'=>'模板3'],['id'=>'4','name'=>'模板4'],['id'=>'5','name'=>'模板5'],['id'=>'6','name'=>'模板6'],['id'=>'7','name'=>'模板7']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['theme']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="readonly[]">
                            <?php foreach([['id'=>'0','name'=>'是否只读:否'],['id'=>'1','name'=>'是否只读:是']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if(isset($vo['readonly']) && $vo['readonly']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                        </div>
                        <div class="layui-col-sm3">
                          <!-- 标题 -->
                          <div class="">
                            <input class="layui-input" name="comment[]" value="{$vo['comment']|default=''}" placeholder="标题" />
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="append[]" placeholder="默认值">{$vo['append']|default=''}</textarea>
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="notes[]" placeholder="页面备注内容">{$vo['notes']|default=''}</textarea>
                          </div>
                        </div>
                        <div class="layui-col-sm5">
                          <div class="">
                            <textarea class="layui-input" name="append1[]" placeholder="扩展参数1  form_time(time_type),form_radio(parm_data),form_checkbox(id_t),form_select(id_t)">{$vo['append1']|default=''}</textarea>
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="append2[]" placeholder="扩展参数2  form_checkbox(name_t),form_select(name_t)">{$vo['append2']|default=''}</textarea>
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="append3[]" placeholder="扩展参数3  form_checkbox(list_arr),form_select(list_arr)">{$vo['append3']|default=''}</textarea>
                          </div>
                        </div>
                      </div>

                      <hr>
                    <?php } ?>
                    
                    <h1>右边栏目</h1>
                    <?php if(isset($list['right'][0]['name'])){  foreach($list['right'] as $k=>$vo){ ?>
                      <div class="layui-row">
                        <div class="layui-col-sm2">
                          <div>
                            <input name="name[]" type="hidden" value="{$vo['name']}" />
                            <span class="{$vo['checked']==0?'line-through':''}" style="font-size: 16px;" >{$vo['name']}<br>({$vo['type']})</span>
                          </div>
                          <div class="" >
                            <input class="layui-input" name="sort[]" value="{$vo['sort']|default=''}" placeholder="排序" />
                          </div>
                        </div>
                        <div class="layui-col-sm2">
                          <select class="layui-input layui-select" name="model[]">
                            <?php foreach(formProActionArrCate() as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['model']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="checked[]">
                            <?php foreach([['id'=>'1','name'=>'显示'],['id'=>'0','name'=>'隐藏']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['checked']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="postion[]">
                            <?php foreach([['id'=>'left','name'=>'左边'],['id'=>'right','name'=>'右边']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['postion']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="theme[]">
                            <?php foreach([['id'=>'1','name'=>'模板1'],['id'=>'2','name'=>'模板2'],['id'=>'3','name'=>'模板3'],['id'=>'4','name'=>'模板4'],['id'=>'5','name'=>'模板5'],['id'=>'6','name'=>'模板6'],['id'=>'7','name'=>'模板7']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if($vo['theme']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                          <select class="layui-input layui-select" name="readonly[]">
                            <?php foreach([['id'=>'0','name'=>'是否只读:否'],['id'=>'1','name'=>'是否只读:是']] as $k1=>$vo1){ ?>
                              <option value="{$vo1['id']}" <?php if(isset($vo['readonly']) && $vo['readonly']==$vo1['id']){ ?>selected<?php } ?>>{$vo1['name']}</option>
                            <?php } ?>
                          </select>
                        </div>
                        <div class="layui-col-sm3">
                          <!-- 标题 -->
                          <div class="">
                            <input class="layui-input" name="comment[]" value="{$vo['comment']|default=''}" placeholder="标题" />
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="append[]" placeholder="默认值">{$vo['append']|default=''}</textarea>
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="notes[]" placeholder="页面备注内容">{$vo['notes']|default=''}</textarea>
                          </div>
                        </div>
                        <div class="layui-col-sm5">
                          <div class="">
                            <textarea class="layui-input" name="append1[]" placeholder="扩展参数1  form_time(time_type),form_radio(parm_data),form_checkbox(id_t),form_select(id_t)">{$vo['append1']|default=''}</textarea>
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="append2[]" placeholder="扩展参数2  form_checkbox(name_t),form_select(name_t)">{$vo['append2']|default=''}</textarea>
                          </div>
                          <div class="">
                            <textarea class="layui-input" name="append3[]" placeholder="扩展参数3  form_checkbox(list_arr),form_select(list_arr)">{$vo['append3']|default=''}</textarea>
                          </div>
                        </div>
                      </div>

                      <br>
                    <?php }} ?>
                    
                  

                  
                  <br>
                  </div>
                  
                  <br><br><br><br><br><br>
                  <br><br><br><br><br><br>
                </div>
                  
                {include file="public/widget_submit"}
            </div>
          </div>
        </form>
      <?php }elseif($t==2){ ?>
        <form method="post" class="info_tj" >
          <div class="layui-col-sm12">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-sm12">
                  <div class="layui-card">
                    <style>
                      .layui-input{
                        height: 400px;
                      }
                    </style>
                    {$form_widget->form_textarea(['title'=>'导入参数','name'=>'form_parm','data'=>'','theme'=>1])|raw}
                  <br>
                  </div>
                  
                </div>
                  
                {include file="public/widget_submit"}
            </div>
          </div>
        </form>
      <?php }elseif($t==3){ ?>
          <div class="layui-col-sm12">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-sm12">
                  <div class="layui-card">
                    <style>
                      .layui-input{
                        height: 500px;
                      }
                    </style>
                    {$form_widget->form_textarea(['title'=>'当前参数','name'=>'form_parm','data'=>$form_parm, 'readonly'=>1,'theme'=>1])|raw}
                  <br>
                  </div>
                  
                </div>
                  
            </div>
          </div>
      <?php }elseif($t==4){ ?>
        <form method="post" class="info_tj layui-form" >
          <div class="layui-col-sm12">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-sm12">
                  <div class="layui-card">
                    <style>
                      .layui-input{
                        height: 400px;
                      }
                    </style>
                    <div class="layui-card-header">
                      <input type="checkbox" lay-skin="primary"  id="c_all" lay-filter="c_all" title="全部">
                    </div> 
                    {$form_widget->form_checkbox(['title'=>'静态文件','name'=>'form_parm_static','data'=>$form_parm_static,'list_arr'=>formWidgetStatic(),'theme'=>2])|raw}
                    <br> 
                  </div>
                  <span>如果选项为❌则表示未下载,请===> <a  onclick='zfAdminShow("系统工具","{:url('admin/config/tool',['site_t' => 'style'] )}")' >点击此处下载</a>,下载后刷新本页面</span>
                  <br>
                  <span>如果你使用的样式是远程文件,则可忽略</span>
                  <script>
                    
                  </script>
                </div>
                  
                {include file="public/widget_submit"}
            </div>
          </div>
        </form>
      <?php } ?>
        
      </div>
    </div>
  </div>
  


  <script>

 layui.use(['form','upload'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
    ,form = layui.form
    ,upload = layui.upload;

      form.on('checkbox(c_all)', function (data) {
        var a = data.elem.checked;
        if (a == true) {
          $('input[name="zf_list_form_parm_static[]"]').prop("checked", true);
          form.render('checkbox');
        } else {
          $('input[name="zf_list_form_parm_static[]"]').prop("checked", false);
          form.render('checkbox');
        }

      });

    
      $('.tijiao').on("click",function(){
          // var index = layer.load(2);
          var data = $(".info_tj input,.info_tj select,.info_tj textarea,.info_tj radio").serialize();      
          $.ajax({
              type:'post',
              data:data,
              dataType:'json',
              success:function(res){
                if(res.result==1){
                  layer.msg(res.msg, {icon: 1});
                  setTimeout(function() {
                        window.location.reload();
                  }, 2000);
                }else{
                  // layer.close(index);
                  layer.msg(res.msg, {icon: 2});
                }   
              }
          })
      })

      //当select checked[]的值发生改变时，触发事件
      $('.info_tj').on('change','select[name="checked[]"]',function(){
        var val = $(this).val();
        console.log(val)
        if(val==0){
          $(this).parent().parent().find('span').addClass('line-through');
        }else{
          $(this).parent().parent().find('span').removeClass('line-through');
        }
      })

      


  });
  </script>
</body>
</html>
{:do_action('admin_js')}

